<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        .box{
            /* width: 150px; */
            height: 60px;
            /* border: 1px solid #000; */
            margin: 100px auto;
            text-align: center;
            overflow: hidden;
        }
        button{
            font-size: 30px;
            width: 60px;
            height: 60px;
            background-color: #fff;
            border: none;
            outline: none;
        }
        button:nth-child(2){
            float: right;
        }
        span{
            font-size: 30px;
        }
    </style>
</head>
<body>
    <div id="app" class="box">
        <button @click="cutData">-</button>
        <span>{{massage}}</span>
        <button @click="addData">+</button>
    </div>
    <script src="script/vue.js"></script>
    <script>
        let i = 0;
        const vue = new Vue({
            data : {
                massage : 1
            },
            methods : {
                addData(){
                    i++;
                    this.massage = i
                },
                cutData(){
                    i--;
                    if(i < 0){
                        i = 0
                    }
                    this.massage = i
                }
            }
        })
        vue.$mount("#app");
    </script>
</body>
</html>